#include "app.h"

BEGIN_EVENT_TABLE(Game, wxGLCanvas)
	EVT_PAINT(Game::OnPaint)
	EVT_IDLE(Game::OnUpdate)
	EVT_ERASE_BACKGROUND(Game::Empty)
	EVT_KEY_DOWN(Game::OnKeyDown)
	EVT_KEY_UP(Game::OnKeyUp)
END_EVENT_TABLE()

bool App::OnInit() {
	frame = new wxFrame((wxFrame *)NULL, -1, wxT("forge"), wxDefaultPosition, wxSize(-1, -1), wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxRESIZE_BOX | wxMAXIMIZE_BOX));
	frame->SetClientSize(wxSize(320, 240));
	wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);

	int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
	Game *game = new Game((wxFrame *)frame, args);

	sizer->Add(game, 1, wxEXPAND);
	frame->SetSizer(sizer);
	frame->SetAutoLayout(true);
	frame->Center();
	frame->Show();

	return true;
}

IMPLEMENT_APP(App)
